package com.demo;

public class Account {
    /*private Allocator actr = DeadLock02.getInstance();
    private int balance;
    void transfer(Account target, int amt){
        while(!actr.apply(this, target));
        try{
            synchronized(this){
                System.out.println(this.toString()+" lock obj1");
                synchronized(target){
                    System.out.println(this.toString()+" lock obj2");
                    if (this.balance > amt){
                        this.balance -= amt;
                        target.balance += amt;
                    }
                }
            }
        } finally {
            //执行完后，再释放持有的资源
            actr.clean(this, target);
        }
    }
}

    private void Allocator(){};

private static class SingleTonHoler{
    private static Allocator INSTANCE = new Allocator();
}

    public static Allocator getInstance(){
        return SingleTonHoler.INSTANCE;
    }*/
}
